#!/usr/bin/env python
# coding: utf-8
"""
@Author : ZhaoBin
@Date   : 2018-11-29 11:09:00
@Last Modified by   : ZhaoBin
@Last Modified time : 2018-12-11 10:07:20
"""
import logging

import requests
from celery import Celery
from time import sleep
import settings

app = Celery("tasks", broker=settings.BROKER_URL, backend=settings.CELERY_RESULT_BACKEND)
app.conf.update(CELERY_TIMEZONE='UTC',
                CELERY_ENABLE_UTC=True)
# print(app.conf)
# app.conf.update(
#     # BROKER_TRANSPORT_OPTIONS=settings.BROKER_TRANSPORT_OPTIONS,
#     CELERY_TASK_TIME_LIMIT=400)


class A:
    req = requests.Session()

    def login(self, user, pwd):
        pass


@app.task()
def main(name):
    logging.info("____ In Main ____")
    print(1, name)
    logging.info("____ In Main over ____")
    sleep(5)
    logging.info("____ sleep 1 ____")
    return "hello world", name


"""
activate aust
celery -A tasks worker -l info


"""
